<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>
<?=$page_title?>
</title>
<base href="<?=base_url()?>" />
<script type="text/javascript" src="js/jquery.js"></script>
<!--弹窗-->
<link href="css/clientpublic.css" rel="stylesheet" type="text/css">
<link href="css/esui.css" rel="stylesheet" type="text/css">
<link href="css/initaccount.css" rel="stylesheet" type="text/css">
<link href="css/guo.css" rel="stylesheet" type="text/css">

<script type="text/javascript" src="js/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<script type="text/javascript" src="js/fancybox/jquery.easing-1.3.pack.js"></script>
<script type="text/javascript" src="js/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="js/fancybox/jquery.fancybox-1.3.4.css" />
<link rel="stylesheet" type="text/css" href="css/jia.css" />
<script type="text/javascript">
	$(document).ready(function() {
		jQuery.ajaxSetup ({cache:false}); /*让ajax不调用浏览的缓存*/
		$(".various1").fancybox({
		'titleShow'     : false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'easingIn'      : 'easeOutBack',
		'easingOut'     : 'easeInBack'
		});
	});
</script>
</head>
<body>
	<div id="Holder">
		<div id="MainPage">
			<!---------头部------------->
			<?php include('top.php')?>
			<div id="Subnav">
				<ul>

					<li class="active show"></li>

				</ul>
			</div>
			<!---------中间部分------------->
			<div id="MainBody">
				<div class="welcome_me">
					Welcome to <span>CRM</span>
				</div>
				<div class="p_list">
					<ul class="p_list_tit clearfix">
						<li class="cur"><a>基本信息</a></li>
						<!--                         <li><a>详细信息</a></li> -->
						<!--                         <li><a>兴趣爱好</a></li> -->
						<li><a>修改密码</a></li>
					</ul>
					<ul class="p_list_cont">
						<li>
							<form action="index.php/user/modify_base_info" method="post">
								<table class="1_table">
									<tr>
										<th>用户名：</th>
										<td><?= $personal->user_name?></td>
									</tr>
									<tr>
										<th>账户：</th>
										<td><?= $personal->account?></td>
									</tr>
									<tr>
										<th>角色：</th>
										<td><?= $personal->role?></td>
									</tr>
									<tr>
										<th>邮箱：</th>
										<td><?= $personal->email?></td>
									</tr>
									<tr>
										<td colspan="2"><input class="p_but" type="button"
											value="保存更改"><input class="p_but_1" type="button" value="修改"></td>
									</tr>
								</table>

								<table style="display: none;">
									<tr>
										<th>用户名：</th>
										<td><input type="text" value="<?= $personal->user_name?>"
											name="user_name"></td>
									</tr>
									<tr>
										<th>账户：</th>
										<td><input type="text" value="<?= $personal->account?>"
											name="account"></td>
									</tr>
									<!-- <tr>
										<th>角色：</th>
										<td>
										  <select name="role" style=" width:198px; margin-left:3px;">
                							<option value="市场" <?php if($personal->role == '市场'):?>selected='selected'<?php endif;?>>市场</option>
                							<option value="经理" <?php if($personal->role == '经理'):?>selected='selected'<?php endif;?>>经理</option>
                						  </select>
										</td>
									</tr> -->
									<tr>
										<th>邮箱：</th>
										<td><input type="text" value="<?= $personal->email?>"
											id="email" name="email"></td>
									</tr>
									<tr>
										<td colspan="2"><input class="p_but" id="modify" type="submit"
											value="保存更改"><input class="p_but_3"
											type="reset" value="清除"></td>
									</tr>
								</table>
								<input type="hidden" name="id" value="<?= $personal->id?>" />
							</form>
						</li>
						<li id="4" style="display: none;">
							<form action="index.php/user/modify_pswd" method="post">
								<table>
									<tr>
										<th>新密码：</th>
										<td><input type="password" id="pasd" name="pasd"></td>
									</tr>
									<tr>
										<th>确认密码：</th>
										<td><input type="password" id="pasd1" name="pasd1"></td>
									</tr>
									<tr>
										<td colspan="2"><input class="p_but_2" type="submit"
											value="保存更改"></td>
									</tr>
								</table>
								<input type="hidden" name="id" value="<?= $personal->id?>" />
							</form>
						</li>
					</ul>
				</div>
				<script type="text/javascript">
					$(document).ready(function(){
						$(".p_list_tit li").click(function(){
							$(".p_list_tit li").removeClass("cur");
							$(this).addClass("cur");
							$(".p_list_cont li").hide();
							var i=$(".p_list_tit li").index(this)
							$(".p_list_cont li").eq(i).show();	
						});
						
						$(".1_table .p_but_1").click(function(){
							$(".1_table").hide();
							$(".1_table").next("table").show();
						});

						$("#4 .p_but_2").click(function(){
							var pasd = $("#pasd").val();
							var pasd1 = $("#pasd1").val();
							if(!pasd || !pasd1){
								alert("密码不能为空");
								return false;
							}else{
								if(pasd != pasd1){
									alert("密码两次输入不相同");
									return false;
									}else{
									  var length = pasd.length;
									  if(length < 5){
											alert("密码不能小于5位");  
											return false;
										}else{
											return true;
										}
									}
								}
						});

						$("#modify").click(function(){
							var email = $("#email").val();
							if(!email){
								  alert("邮箱不能为空");
								  return false;
							}else{
								if(!email.match(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)){
									alert("格式不正确！请重新输入");
									$("#email").focus();
									return false;
								}else{
									return true;	
								}
							}
						 })
					});	

				</script>

			</div>
			<!---------结尾------------->
			<?php include('footer.php')?>
		</div>
	</div>
</body>
</html>